/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Osito
 */
@Entity
@Table(name = "zamowienie")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Zamowienie.findAll", query = "SELECT z FROM Zamowienie z"),
    @NamedQuery(name = "Zamowienie.findById", query = "SELECT z FROM Zamowienie z WHERE z.id = :id"),
    @NamedQuery(name = "Zamowienie.findByIlosc", query = "SELECT z FROM Zamowienie z WHERE z.ilosc = :ilosc"),
    @NamedQuery(name = "Zamowienie.findByCena", query = "SELECT z FROM Zamowienie z WHERE z.cena = :cena"),
    @NamedQuery(name = "Zamowienie.findByWartosc", query = "SELECT z FROM Zamowienie z WHERE z.wartosc = :wartosc")})
public class Zamowienie implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Column(name = "ilosc")
    private Integer ilosc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cena")
    private float cena;
    @Basic(optional = false)
    @NotNull
    @Column(name = "wartosc")
    private float wartosc;
    @JoinColumn(name = "towar", referencedColumnName = "nazwa")
    @ManyToOne
    private Towary towar;
    @JoinColumn(name = "klient", referencedColumnName = "nick")
    @ManyToOne
    private Klienci klient;

    public Zamowienie() {
    }

    public Zamowienie(Integer id) {
        this.id = id;
    }

    public Zamowienie(Integer id, float cena, float wartosc) {
        this.id = id;
        this.cena = cena;
        this.wartosc = wartosc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getIlosc() {
        return ilosc;
    }

    public void setIlosc(Integer ilosc) {
        this.ilosc = ilosc;
    }

    public float getCena() {
        return cena;
    }

    public void setCena(float cena) {
        this.cena = cena;
    }

    public float getWartosc() {
        return wartosc;
    }

    public void setWartosc(float wartosc) {
        this.wartosc = wartosc;
    }

    public Towary getTowar() {
        return towar;
    }

    public void setTowar(Towary towar) {
        this.towar = towar;
    }

    public Klienci getKlient() {
        return klient;
    }

    public void setKlient(Klienci klient) {
        this.klient = klient;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zamowienie)) {
            return false;
        }
        Zamowienie other = (Zamowienie) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Zamowienie[ id=" + id + " ]";
    }
    
}
